#include "renderPotato.h"
#define SCALE 4

renderPotato::renderPotato(float init_red, float init_green, float init_blue)
{
	//Initialize the variables
	r = init_red; g = init_green; b = init_blue;
}

renderPotato::~renderPotato(void)
{
}
// This draw method is intended to draw the shapes, set the material
// and appropriately texture the shapes generated.
// In this case, there is no required texture, we are simply using
// appropriate colouring. Textures felt inappropriate in this case.
void renderPotato::draw(float init_x, float init_y, float init_z)
{
	x = (init_x) * SCALE;
	y = (init_y) * SCALE;
	z = ((init_z) * SCALE) + ( .4 * SCALE );

	//	/* Set up material properties. */
	GLfloat mat_ambient[] = { 1, 0.1, 0.1, 1 };
	GLfloat mat_diffuse[] = { 0.2, 0.2, 0.2, 1 };
	GLfloat mat_specular[] = { 0.8, 0.8, 0.8, 1 };

	glPushMatrix();

	glTranslatef(x + SCALE / 2, y + SCALE / 2, z);
	glColor3f(0.58, 0.29, 0); 
	glScalef(0.86,1.36,1);
	
	//glScalef(0.5,0.5,0.5);

	glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
	glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
	glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
	glMaterialf(GL_FRONT, GL_SHININESS, 10.0 ); /* No effect if specular == 0 */

	glRotatef(90, 1.0, 0.0, 0.0);
	glutSolidSphere(SCALE/4, 12, 12);

	glTranslatef(-x - SCALE / 2, -y - SCALE / 2, -z);

	glPopMatrix();
}